1 Transects

Plant Flowers Date lon lat ele Month Year julian
Glossoloma oblongicalyx 4 2015-10-19 -78.59093 0.130838 2270 October 2015 292
Gasteranthus quitensis 2 2016-10-17 -78.59770 0.120070 1940 October 2016 291
Kohleria affinis 1 2016-12-13 -78.59534 0.126746 2110 December 2016 348
Columnea ciliata 3 2014-02-27 -78.59934 0.116682 1960 February 2014 58
Columnea medicinalis 1 2014-04-23 -78.59372 0.128700 2130 April 2014 113
Drymonia teuscheri 3 2016-07-28 -78.59245 0.129393 2200 July 2016 210

2 Phylogeny

3 Traits

Plant Flowers Date lon lat ele Month Year julian
Glossoloma oblongicalyx 4 2015-10-19 -78.59093 0.130838 2270 October 2015 292
Gasteranthus quitensis 2 2016-10-17 -78.59770 0.120070 1940 October 2016 291
Kohleria affinis 1 2016-12-13 -78.59534 0.126746 2110 December 2016 348
Columnea ciliata 3 2014-02-27 -78.59934 0.116682 1960 February 2014 58
Columnea medicinalis 1 2014-04-23 -78.59372 0.128700 2130 April 2014 113
Drymonia teuscheri 3 2016-07-28 -78.59245 0.129393 2200 July 2016 210

3.0.1 Total Flowers

3.1 Peak date

3.2 Julian Day

## sink("model/normal_julian.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
## 
##       #Effect of environment
##       mu[x] <- alpha[Plant[x]] + beta[Plant[x]] * ele[x]
## 
##       #observation
##       Yobs[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##       
##       #Residuals
##       residuals[x] <- Yobs[x] - mu[x]
##       
##       #squared error
##       sq[x]<-pow(residuals[x],2)
## 
##       #Assess Model Fit - squared residuals
##       Ynew[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##       sq.new[x]<-pow(Ynew[x] - mu[x],2)
##     
##     }
##     
##     #Root mean squared residuals
##     fit<-sqrt(sum(sq[])/Nobs)
##     fitnew<-sqrt(sum(sq.new[])/Nobs)  
## 
##     #Prediction
## 
##     for(i in 1:Npreds){
## 
##       #predict value
##       mu_new[i]<-alpha[Ypred_plant[i]] + beta[Ypred_plant[i]] * ele_new[Ypred_plant[i]]
##       prediction[i] ~ dnorm(mu_new[i],tau[Ypred_plant[i]])T(0,365)
##     
##       #squared predictive error
##       pred_error[i] <- pow(Ypred[i] - prediction[i],2)
##     }
## 
##     #Root Mean Squared Predictive Error
##     fitpred<-sqrt(sum(pred_error[])/Npreds)
## 
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     alpha[j] ~ dnorm(0,0.0001)
##   
##     #Effect of elevation
##     beta[j] ~ dnorm(0,0.0001)
## 
##     #variance
##     sigma[j] ~ dunif(0,75)
##     tau[j] <- pow(sigma[j], -2)
##     } 
##     
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 7309
##    Unobserved stochastic nodes: 8681
##    Total graph size: 61377
## 
## Initializing model

3.2.1 Evaluate convergence

3.2.2 Posterior estimates

3.2.3 Estimated phenology

Red is the kernel density from the underlying data Black is the modeled phenology

3.2.4 Predicted phenology

4 Phylogeny

4.1 Attraction

## sink("model/normal_attraction.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
## 
##       #observation
##       mu[x] <-  alpha + beta[Plant[x]] * ele[x] + e[Plant[x]]
##       Yobs[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##       
##       #Residuals
##       residuals[x] <- Yobs[x] - mu[x]
##       
##       #squared error
##       sq[x]<-pow(residuals[x],2)
## 
##       #Assess Model Fit - squared residuals
##       Ynew[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##       sq.new[x]<-pow(Ynew[x] - mu[x],2)
##     
##     }
##     
##     #Root mean squared error
##     fit<-sqrt(sum(sq[])/Nobs)
##     fitnew<-sqrt(sum(sq.new[])/Nobs)
## 
##     #autocorrelation in error
##     e[1:Plants] ~ dmnorm(zeros[],tauC[,])
##     
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter
##     
##     iC=inverse(omega*C[,])
##     tauC=iC
##     tauC2=iC
##     
##     ###########
##     #Prediction
##     ###########
## 
##     for(i in 1:Npreds){
##     
##     #predict value
##     mu_new[i] <-  alpha + beta[Ypred_plant[i]] * ele_new[i] + e[Ypred_plant[i]]
##     prediction[i] ~ dnorm(mu_new[i],tau[Ypred_plant[i]])T(0,365)
##     
##     #squared predictive error
##     pred_error[i] <- pow(Ypred[i] - prediction[i],2)
##     }
##     
##     #Root Mean Squared Predictive Error
##     fitpred<-sqrt(sum(pred_error)/Npreds)
##     
##     # Priors #
##     ##########
## 
##     #Species level priors
##     
##     for (j in 1:Plants){
## 
##     beta[j] ~ dnorm(0,0.0001)
## 
##     #variance
##     sigma[j] ~ dunif(0,75)
##     tau[j] <- pow(sigma[j], -2)
##     } 
## 
##     #Intercept
##     alpha ~ dnorm(0,0.0001)
##     
##     #Strength of covariance decay
##     lambda ~ dunif(0,5)
## 
##     #Magnitude of the phylogenetic effect
##     omega ~ dunif(0,20)
##     
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 6991
##    Unobserved stochastic nodes: 8249
##    Total graph size: 61002
## 
## Initializing model

5 Get Chains

5.0.1 Evaluate convergence

5.0.2 Posterior estimates

5.1 Estimated Phenology

5.2 Predicted Phenology

5.3 Decay in phylogenetic attraction

5.4 Repulsion

## sink("model/normal_repulsion.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #observation
##     mu[x] <- alpha + beta[Plant[x]] * ele[x] + e[Plant[x]]
##     Yobs[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##     
##     #Residuals
##     residuals[x] <- Yobs[x] - mu[x]
##     
##     #squared error
##     sq[x]<-pow(residuals[x],2)
##     
##     #Assess Model Fit - squared residuals
##     Ynew[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##     sq.new[x]<-pow(Ynew[x] - mu[x],2)
##     
##     }
##     
##     #sum of squared error
##     #Root mean squared error
##     fit<-sqrt(sum(sq[])/Nobs)
##     fitnew<-sqrt(sum(sq.new[])/Nobs)
##     
##     #autocorrelation in error
##     e[1:Plants] ~ dmnorm(zeros[],tauC[,])
##     
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda * D[i,j])
##     }
##     }
##     
##     #Inverse matrix correlation for repulsion - see Ives and Helmus 2011
##     #For clarity sake this is performed, even though it is undone by converting to precision
##     iC=inverse(omega * C[,])
##     
##     ## Covert variance to precision for each parameter
##     
##     iiC=inverse(iC[,])
##     tauC=iiC
##     tauC2=iiC
##     
##     ###########
##     #Prediction
##     ###########
## 
##     for(i in 1:Npreds){
##     
##     #predict value
##     mu_new[i] <- alpha + beta[Ypred_plant[i]] * ele_new[i] + e[Ypred_plant[i]]
##     prediction[i] ~ dnorm(mu_new[i],tau[Ypred_plant[i]])T(0,365)
##     
##     #squared predictive error
##     pred_error[i] <- pow(Ypred[i] - prediction[i],2)
##     }
##     
##     #Root Mean Squared Predictive Error
##     fitpred<-sqrt(sum(pred_error)/Npreds)
##     
##     # Priors #
##     ##########
##     
##     #Julian Intercept
##     alpha ~ dnorm(0,0.0001)
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #effect of elevation
##     beta[j] ~ dnorm(0,0.0001)
## 
##     #variance
##     sigma[j] ~ dunif(0,75)
##     tau[j] <- pow(sigma[j], -2)
##     } 
##     
##     #Strength of covariance decay
##     lambda ~ dunif(0,5)
##     omega ~ dunif(0,20)
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 6991
##    Unobserved stochastic nodes: 8249
##    Total graph size: 61003
## 
## Initializing model

6 Get Chains

6.0.1 Evaluate convergence

6.0.2 Posterior estimates

6.1 Estimated Phenology

6.2 Predicted Phenology

6.3 Decay in phylogenetic repulsion

7 Traits

7.1 Trait Attraction

## sink("model/normal_attraction.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
## 
##       #observation
##       mu[x] <-  alpha + beta[Plant[x]] * ele[x] + e[Plant[x]]
##       Yobs[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##       
##       #Residuals
##       residuals[x] <- Yobs[x] - mu[x]
##       
##       #squared error
##       sq[x]<-pow(residuals[x],2)
## 
##       #Assess Model Fit - squared residuals
##       Ynew[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##       sq.new[x]<-pow(Ynew[x] - mu[x],2)
##     
##     }
##     
##     #Root mean squared error
##     fit<-sqrt(sum(sq[])/Nobs)
##     fitnew<-sqrt(sum(sq.new[])/Nobs)
## 
##     #autocorrelation in error
##     e[1:Plants] ~ dmnorm(zeros[],tauC[,])
##     
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter
##     
##     iC=inverse(omega*C[,])
##     tauC=iC
##     tauC2=iC
##     
##     ###########
##     #Prediction
##     ###########
## 
##     for(i in 1:Npreds){
##     
##     #predict value
##     mu_new[i] <-  alpha + beta[Ypred_plant[i]] * ele_new[i] + e[Ypred_plant[i]]
##     prediction[i] ~ dnorm(mu_new[i],tau[Ypred_plant[i]])T(0,365)
##     
##     #squared predictive error
##     pred_error[i] <- pow(Ypred[i] - prediction[i],2)
##     }
##     
##     #Root Mean Squared Predictive Error
##     fitpred<-sqrt(sum(pred_error)/Npreds)
##     
##     # Priors #
##     ##########
## 
##     #Species level priors
##     
##     for (j in 1:Plants){
## 
##     beta[j] ~ dnorm(0,0.0001)
## 
##     #variance
##     sigma[j] ~ dunif(0,75)
##     tau[j] <- pow(sigma[j], -2)
##     } 
## 
##     #Intercept
##     alpha ~ dnorm(0,0.0001)
##     
##     #Strength of covariance decay
##     lambda ~ dunif(0,5)
## 
##     #Magnitude of the phylogenetic effect
##     omega ~ dunif(0,20)
##     
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 7302
##    Unobserved stochastic nodes: 8656
##    Total graph size: 64302
## 
## Initializing model

8 Get Chains

8.0.1 Evaluate convergence

8.0.2 Posterior estimates

8.1 Estimated Phenology

8.2 Predicted Phenology

8.3 Decay in trait attraction

8.4 Repulsion

## sink("model/normal_repulsion.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #observation
##     mu[x] <- alpha + beta[Plant[x]] * ele[x] + e[Plant[x]]
##     Yobs[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##     
##     #Residuals
##     residuals[x] <- Yobs[x] - mu[x]
##     
##     #squared error
##     sq[x]<-pow(residuals[x],2)
##     
##     #Assess Model Fit - squared residuals
##     Ynew[x] ~ dnorm(mu[x],tau[Plant[x]])T(0,365)
##     sq.new[x]<-pow(Ynew[x] - mu[x],2)
##     
##     }
##     
##     #sum of squared error
##     #Root mean squared error
##     fit<-sqrt(sum(sq[])/Nobs)
##     fitnew<-sqrt(sum(sq.new[])/Nobs)
##     
##     #autocorrelation in error
##     e[1:Plants] ~ dmnorm(zeros[],tauC[,])
##     
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda * D[i,j])
##     }
##     }
##     
##     #Inverse matrix correlation for repulsion - see Ives and Helmus 2011
##     #For clarity sake this is performed, even though it is undone by converting to precision
##     iC=inverse(omega * C[,])
##     
##     ## Covert variance to precision for each parameter
##     
##     iiC=inverse(iC[,])
##     tauC=iiC
##     tauC2=iiC
##     
##     ###########
##     #Prediction
##     ###########
## 
##     for(i in 1:Npreds){
##     
##     #predict value
##     mu_new[i] <- alpha + beta[Ypred_plant[i]] * ele_new[i] + e[Ypred_plant[i]]
##     prediction[i] ~ dnorm(mu_new[i],tau[Ypred_plant[i]])T(0,365)
##     
##     #squared predictive error
##     pred_error[i] <- pow(Ypred[i] - prediction[i],2)
##     }
##     
##     #Root Mean Squared Predictive Error
##     fitpred<-sqrt(sum(pred_error)/Npreds)
##     
##     # Priors #
##     ##########
##     
##     #Julian Intercept
##     alpha ~ dnorm(0,0.0001)
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #effect of elevation
##     beta[j] ~ dnorm(0,0.0001)
## 
##     #variance
##     sigma[j] ~ dunif(0,75)
##     tau[j] <- pow(sigma[j], -2)
##     } 
##     
##     #Strength of covariance decay
##     lambda ~ dunif(0,5)
##     omega ~ dunif(0,20)
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 7302
##    Unobserved stochastic nodes: 8656
##    Total graph size: 64303
## 
## Initializing model

9 Get Chains

9.0.1 Evaluate convergence

9.0.2 Posterior estimates

9.1 Estimated Phenology

9.2 Predicted Phenology

9.3 Decay in trait repulsion

10 Model Comparison

10.1 Alpha

10.2 E: The effect of autocorrelation on mean flowering date

10.3 Omega: The magnitude of the effect of autocorrelation on mean flowering date

10.4 Beta: The effect of elevation on flowering timing

10.5 Estimated Phenology

10.6 Effect of autocorrelation

10.7 Decay in autocorrelation effect

11 Model Fit

11.1 Bayesian pvalue

## # A tibble: 5 x 2
##   Model                       p
##   <chr>                   <dbl>
## 1 julian                      0
## 2 phylogenetic_attraction     0
## 3 phylogenetic_repulsion      0
## 4 trait_attraction            0
## 5 trait_repulsion             0

11.2 Overall

11.3 By Species

12 Prediction

12.1 Predicted Phenology